package com.wiegand {
	import com.wiegand.util.ExtendedArray;

	import flash.display.Stage;
	import flash.events.EventDispatcher;

	/**
	 * @author kwiegand
	 */
	 
	public class Configuration extends EventDispatcher{

		private static var _instance : Configuration;
		
		public static const BORDER : int = 50;
		
		private var _elements : XMLList;
		private var _main : Main;
		private var _stage : Stage;
		private var _dict : ExtendedArray;


		public static function getInstance() : Configuration{
			if( _instance == null )
				_instance = new Configuration( new SingletonEnforecer() );
			return _instance;
		}
		
		public function Configuration( blocker:SingletonEnforecer ):void{
			if ( blocker == null ) {
            	throw new Error("Error: SingletonEnforecer");
          	}
          	else{}
		}
		
		public function set main( main:Main ) : void{		
			_main = main;		
		}
		
		public function get main():Main{
			return _main;
		}
		
		public function set elements( elements:XMLList ) : void{		
			_elements = elements;		
		}
		
		public function get elements():XMLList{
			return _elements;
		}
		
		public function get contents():XMLList{
			return _elements.contents;
		}
		
		public function set stage( stage:Stage ) : void{		
			_stage = stage;		
		}
		
		public function get stage():Stage{
			return _stage;
		}
		
		public function set dict( dict:ExtendedArray ) : void{		
			_dict = dict;		
		}
		
		public function get dict():ExtendedArray{
			return _dict;
		}
		
	}
}

internal class SingletonEnforecer {}
